<?php

function escape($data, $mysql = null){
	if($mysql){
		$mysql->connect();
	}
	
	if(get_magic_quotes_gpc()){
		$data = stripslashes($data);
	}
	
	$data = mysql_real_escape_string($data);
	
	return $data;
}

function isEmail($email){
	if(preg_match("#^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$#", $email) == 1){
		return true;
	}
	
	return false;
}

?>